import React, {Component} from 'react';
import {StyleSheet, Text, View, Image, ScrollView, Dimensions} from 'react-native';
import {Button, WhiteSpace, WingBlank, Flex, List, Alert, Toast} from '@ant-design/react-native';
import GetCarInfo from '~/pages/developer/info/community/GetCarInfo';
import {connect} from 'react-redux';
import {getParkingPlanCarByItemID, getParkingPlanCar} from '~/api/parking';
import {getBankLoanPageList} from '~/api/bank';
const width = Dimensions.get('window').width;

const mapGetter = (state) => {
    return {
        userinfo: state.userinfo,
        system: state.system,
        parkorder: state.parkorder,
    };
};
class PackGetCar extends Component {
    static navigationOptions = {
        title: '得汽车',
    };

    constructor(props) {
        //调用基类的所有的初始化方法
        super(props);

        // 设置当前组件的属性
        this.state = {
            parkingplancarID: this.props.navigation.getParam('parkingplancarID'),
            parkingplancar: [],
            list: [],
        };
        console.disableYellowBox = true;
        getParkingPlanCar(this.state.parkingplancarID).then((r) => {
            if (r.code === 0) {
                this.setState({
                    parkingplancar: r.data,
                });
            } else {
                Toast.info(r.msg);
            }
        });
    }

    render() {
        return (
            <ScrollView style={{flex: 1}}>
                <Flex
                    justify={'center'}
                    direction={'column'}
                    style={{
                        backgroundColor: 'white',
                        width: '100%',
                        padding: 20,
                        borderRadius: 5,
                    }}>
                    {this.state.parkingplancar.picList != null &&
                        this.state.parkingplancar.picList.map((item) => {
                            return (
                                <Image
                                    style={{width: '100%', height: 200, resizeMode: 'contain'}}
                                    source={{uri: this.state.parkingplancar.HttpHead + '/' + item.FileName}}
                                />
                            );
                        })}
                    <Flex style={{width: '100%', marginTop: 10}}>
                        <Text style={{fontSize: 14, fontWeight: 'bold'}}>汽车品牌： {this.state.parkingplancar.CarName}</Text>
                    </Flex>
                    <Flex style={{width: '100%', marginTop: 10}}>
                        <Text style={{fontSize: 14, fontWeight: 'bold'}}>汽车价值：</Text>
                        <Flex>
                            <Text style={{color: '#ec4f46', fontSize: 14, fontWeight: 'bold'}}>￥{this.state.parkingplancar.CarPrice}</Text>
                        </Flex>
                    </Flex>
                    <Flex style={{width: '100%', marginTop: 10, paddingBottom: 10, borderBottomWidth: 1, borderColor: '#F8F8FF'}}>
                        <Text style={{fontSize: 14, fontWeight: 'bold'}}>赠送规则：</Text>
                        <Text style={{fontSize: 12}}>
                            每<Text style={{color: '#ec4f46'}}>{this.state.parkingplancar.CarGroup}</Text>位业主送一辆
                        </Text>
                    </Flex>
                    <Flex style={{width: '100%', marginTop: 10}}>
                        <Text style={{fontsize: 10, color: 'gray'}}>备注：送车活动待购车位相关手续办理完成后择期举行</Text>
                    </Flex>
                </Flex>
                <GetCarInfo />
            </ScrollView>
        );
    }
}
const styles = StyleSheet.create({
    images: {
        width: '100%',
        height: 200,
    },
});
export default connect(mapGetter)(PackGetCar);
